<style> body { margin:0; } .main { } #div-i-noticeList { overflow-y:auto; -webkit-overflow-scrolling : touch; padding: 4vh 2vh; } #div-i-noticeList .div-c-detailItem { background: #fff; border: 1px solid #ddd; width: 96%; margin: 0 auto 10px; box-sizing: border-box; padding: 10px 15px 0; border-radius: 5px; cursor: pointer; display:flex; flex-direction:column; } .div-c-detailItem .title { font-weight:bold; font-size:18px; } .div-c-detailItem .text { color: silver; font-size:14px; padding: 6px; } .div-c-detailItem img { background-size: cover; max-width: 100%; max-height:200px; } .detailText { border-top:1px solid #ddd; padding-bottom:6px; padding-top:6px; color:#969595; } </style>
<div class='wapper' id="yHactivity" style="background: #F1F1F1 ;">
		<div class="col-xs-12 col-sm-4 col-sm-offset-4 text-center" style="height: 50px;line-height:50px;position: fixed;margin-top: 0px;left: 0px;z-index: 100;background-color:#059BF3;">
			<!-- onclick="back()" -->
			<a id="fanhui-a" class="glyphicon glyphicon-chevron-left fl " onclick="backPage()" style="cursor:pointer; color: white;position:absolute;top:50%;transform:translateY(-50%);font-size: 20px;left:10px;"></a>
			<strong style="font-size: 20px;color: white;">优惠活动</strong>
		</div>
		<div style="height:50px;"></div>
        <div style="" id="div-i-noticeList" class="col-xs-12 col-sm-4 col-sm-offset-4 ">
        </div>
     </div>

<script type="text/javascript">
	$('.foot').hide();
	var BASE_SRC = "/";
	function newActiveItem(item) {
		var html = "<div class='div-c-detailItem' data-id='" + item.id + "'>"+
			"<span class='title'>" + item.name + "</span>"+
			"<img src='/d/cp/" + item.photo_path + "' />"+
			"<span class='detailText'>点击查看活动详情</span>"+
		"</div>";
		return html;
	}
	var USER_MOVE = false;
	$("#div-i-noticeList").on("touchstart", ".div-c-detailItem", function(e) {
		USER_MOVE = false;
	});
	$("#div-i-noticeList").on("touchmove", ".div-c-detailItem", function(e) {
		USER_MOVE = true;
	});
	$("#div-i-noticeList").on(getEndClickEvent(), ".div-c-detailItem", function(e) {
		if (USER_MOVE) {
			return;
		}
		activityId=$(this).attr("data-id");
		var idValue = $(e.currentTarget).attr("data-id");
		save.push('yHactivity');
		bindSetData('yHactivityDetail');
	});
	
	function initActivityList(data) {
		var $noticeList = $("#div-i-noticeList");
		$noticeList.html("");
		for (var i = 0; i < data.length; i++) {
			var html = newActiveItem(data[i]);
			$noticeList.append(html);
		}
	};
	
	$.ajax({
		url: "/act/allActivity.do",
		type: "post",
		data: {},
		success: function(data) {
			if(data == 50) { 
				save.push("sy");
				bindSetData("login"); 
				return;
   			}else if(data==60){
   				pagePreserve();
   				return;
   			}
			if (data.data.length === 0) {
				$("#div-i-noticeList").html("<p style='text-align:center;'>暂无正在进行中的优惠活动</p>");			
			} else {
				initActivityList(data.data);
			}
		},
	});
	 var stopUserScaleScreen = function() {
			window.onload= function () {
			    document.addEventListener('touchstart',function (event) {
			        if(event.touches.length>1){
			            event.preventDefault();
			        }
			    });
			    var lastTouchEnd=0;
			    document.addEventListener('touchend',function (event) {
			        var now=(new Date()).getTime();
			        if(now-lastTouchEnd<=300){
			            event.preventDefault();
			        }
			        lastTouchEnd=now;
			    },false);
			};
 			$("body").on("touchstart touchmove", function(event) {
				if (event.target.closest("#div-i-noticeList") == null) {
					event.preventDefault();
				}
			});		
	  }; 	  
	</script>

